home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ Apr 89 / T0013-Re Dangerous lock i-Apr89 < prev    next >
Encoding:
Text File  |  1989-04-13  |  1.2 KB  |  49 lines  |  [TEXT/GEOL]

  1. Item    5647838                         12-April-89        11:20
  2.  
  3. From:   FRIEDRICH1                      Friedrich, Steve
  4.  
  5. To:     BEL0076                         Hermes Systems SA
  6.  
  7. cc:     MACAPP.TECH$                    MACAPP Tech
  8.  
  9. Sub:    Re: Dangerous lock in 2.0B7
  10.  
  11. The locking mechanism has been changed to:
  12.  
  13. ---------------------------------------------
  14. FUNCTION TObject.Lock(lockIt: BOOLEAN): BOOLEAN;
  15. {$Push} {$IFC qTrace} {$D+} {$ENDC}
  16. {$W+}
  17. {$R-}
  18. {$OV-}
  19. {$S MAMain}
  20. { Locks down or unlocks an object. Returns old state.
  21. Since objects can float around in memory some occasions may arise where they
  22. need to be locked
  23. down (like being referenced by a completion routine.) _PLEASE_ use this
  24. sparingly and don't just
  25. go locking stuff down willy-nilly just because you might be afraid of handles.
  26. }
  27.    VAR
  28.    wasLocked: Boolean;
  29.  
  30.    BEGIN
  31.    wasLocked := IsHandleLocked(self);
  32.    Lock := wasLocked;
  33.    if wasLocked <> lockIt then
  34.    IF lockIt THEN
  35.    HLock(Handle(self))
  36.    ELSE
  37.    HUnLock(Handle(self))
  38.    END;
  39. {$Pop}
  40. ----------------------------------------------
  41. in the next APDA version of MacApp.
  42.  
  43. We will probably just programbreak if you try to free a locked object.
  44. Any comments.
  45.  
  46. Regards,
  47. Steve Friedrich
  48.  
  49.